1. Field of the Invention
The invention relates to a drawing technology such as an image processing apparatus, image processing method and image processing program, particularly to for generating raster format graphic data from vector format graphic data.
2. Description of the Background Art
Images configured by combining geometric graphics primitives such as points, straight lines, curves, rectangles, and ellipses are called vector graphics. On the other hand, images configured by arrays of points (pixels or dots) are called raster graphics.
Generally, images which are displayed on displays or are printed by printers are raster graphics. Therefore, when vector graphics are handled by these devices, processing for transforming those into raster graphics (i.e., rasterizing) is required. The processing cost of rasterizing is high, and a high-performance computer is required for rasterizing complicated vector graphics.
Because proper-resolution raster graphics can be generated every time vector graphics are displayed, there is no case in which the image qualities of contours and the like are deteriorated due to enlargement, reduction, and deformation of images. For this reason, artificial images such as illustrations and drawings, whose contours are clear, are handled as vector graphics in many cases. On the other hand, natural images such as photographs are handled as raster graphics in many cases.
As the most familiar example of the utility of vector graphics, fonts have been known. In early personal computers (hereinafter referred to as “PC”), raster format fonts (bitmap fonts) have been used due to the restrictions on the CPU performances. However, in bitmap fonts, it is necessary to store font data at each resolution, and thus, a large quantity of storage capacity is required.
In accordance with improvement in subsequent CPU performances, current PCs can display high-quality fonts with a less storage capacity in such a manner that vector format font (outline font) data independent of resolution are stored in advance, and fonts at appropriate resolution corresponding to a display or a printer are generated in each case. However, CPUs built into mobile telephones, car navigation systems, or the like have relatively low processing capacities. Hence, there has been an object that arithmetic costs required for rasterizing vector graphics are reduced.
In recent years, graphics processing units (GPUs) have been used in order to achieve the above object. In a rasterizing technique using the GPU, a curve is approximated by using a plurality of triangles. For this reason, when raster graphics are enlarged, the raster graphics have the rough looks. Because it is necessary to improve the approximate accuracy of a curve by using a large number of triangles in order to smoothly rasterize vector graphics, the increases in the storage capacity and the processing cost are inevitable.
To solve these problems, a reference (C. Loop and J. Blinn, Resolution Independent Curve Rendering using Programmable Graphics Hardware, SIGGRAPH 2005) proposes the method which can rasterise the curve always smoothly without depending on the resolution by processing a curve part of the vector graphics for each pixel near the curve not a triangular unit. Since neither the memory capacity nor the processing cost depend on the resolution in this technique, neither the memory capacity nor the processing cost increase.
The reference discloses an even-odd rule as the rasterise method. Here, two kinds of rules such as an even-odd rule and a non-zero rule are widely known as a filling rule when the figure of the vector format is rasterised.
The even-odd rule is as follows: a half-line is drawn from an arbitrary point of in closed region aiming at an arbitrary direction in each closed region inside the figure. The closed region is filled only when the number that the half-lines and contours of the figure intersect is odd number.
On the other hand, in the non-zero rule, a half-line is drawn from an arbitrary point in the closed region aiming at an arbitrary direction in each closed region in the figure, and the counter is incremented and/or decremented according to the direction where the contour of the figure intersects the half-line. For example, when the contour of the figure intersects the half-line from the left to the right for traveling direction of the half-line, the counter is incremented (+1), and when the contour thereof intersects the half-line from the right to the left, the counter is decremented (−1). Increment or decrement of the counter is performed as mentioned above for all intersections of the half-lines and the contours of the figure. As a result, only when the value of the counter is not 0, the closed region is filled.
In a simple figure, the filling result based on these two kinds of rules of the even-odd rule and non-zero rule becomes equal. However, the filling result might be different in a figure which includes the self-intersection and includes a different figure inside thereof (for example, a figure having a hole).